<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%> 
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>Spring-4 + Struts-3 + MyBatis Integration Demo</title>
    <style>
	table.list
	{
		border-collapse:collapse;
		width: 40%;
	}
	table.list, table.list td, table.list th
	{
		border:1px solid gray;
		padding: 5px;
	}
	</style>
</head>
<body>
 
<h2>Spring-4 + Struts-2 + MyBatis Integration Demo</h2>
<h3>検索画面</h3>
<input type=button onclick="window.location.href='<s:url action="menu"/>'" value ="メニュー"> 
<s:fielderror></s:fielderror>
<s:form method="post" action="studentSearch">
    <table>
	    <tr>
	        <td><s:textfield key="label.name" name="student.name"/></td> 
	    </tr>
	    <tr>
	        <td>
	        	<s:submit key="label.search"></s:submit>
	        </td>
	    </tr>
	</table> 
</s:form>
 
     
<h3>検索結果：</h3>
<c:if  test="${!empty students}">
	<table class="list">
		<tr>
		    <th align="left"><s:text name="label.id"/></th>
		    <th align="left"><s:text name="label.name"/></th>
		    <th align="left"><s:text name="label.birthday"/></th>
		    <th align="left"><s:text name="label.address"/></th>
		    <th align="left"><s:text name="操作"/></th>
		</tr>
		<c:forEach items="${students}" var="stu">
		    <tr>
		        <td>${stu.id} </td>
		        <td>${stu.name} </td>
		        <td>${stu.birthday}</td>
		        <td>${stu.address}</td>
		        <td><a href="delete/${stu.id}">delete</a></td>
		    </tr>
		</c:forEach>
	</table>
</c:if>
 
</body>
</html>